<template>
  <div>
    <component
      v-model="com.value"
      v-for="(com, i) in questionList"
      :key="i"
      :is="com.name"
      v-bind="com"
    ></component>
  </div>
</template>

<script>
import Vue from "vue";
import MyRadio from "./components/MyRadio.vue";
import MyCheck from "./components/MyCheck.vue";
function fetchData() {
  return [
    {
      name: "MyRadio",
      title: "单选题1",
      options: [
        {
          label: "op1",
          value: "1"
        },
        {
          label: "op1",
          value: "2"
        }
      ],
      value: "1"
    },
    {
      name: "MyRadio",
      title: "单选题2",
      options: [
        {
          label: "op1",
          value: "1"
        },
        {
          label: "op1",
          value: "2"
        }
      ],
      value: "1"
    },
    {
      name: "MyCheck",
      title: "多选题1",
      options: [
        {
          label: "op1",
          value: "1"
        },
        {
          label: "op1",
          value: "2"
        }
      ],
      value: ["1"]
    }
  ];
}
export default Vue.extend({
  components: {
    MyRadio,
    MyCheck
  },
  data() {
    return {
      questionList: []
    };
  },
  created() {
    this.questionList = fetchData();
  }
});
</script>

<style></style>
